package edu.scau.divineplace.controller;

import edu.scau.divineplace.config.global.log.WebLog;
import edu.scau.divineplace.service.BanWordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

/**
 * @Author: x1aolone
 * @Date: 2021/1/14 16:13
 */
@Slf4j
@RestController
@CrossOrigin
@Api("BanWord控制器")
@WebLog("BanWord控制器")
@Validated
@RequestMapping("/banWord")
public class BanWordController {

    @Autowired
    private BanWordService banWordService;

    @ApiOperation("判断comment里面是否有违禁词")
    @GetMapping("/judge")
    public Boolean judge(@NotBlank String comment) {
        return banWordService.judge(comment);
    }


}
